#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        printf("i am child process\n");
        sleep(5);
        return 0;
    }
    int status = 0;
    pid_t newid = waitpid(id, &status, 0);
    if(newid < 0)
        exit(1);
    else
    {
        printf("%d, %d, %d, %d\n", status, status >> 8, (status >> 7) & 1, (status & 255));
        for(int i = 0; i < 32; i++)
        {
            printf("%d", (status >> i) & 1);
        }
        printf("\n");
        for(int i = 0; i < 32; i++)
        {
            printf("%d", (1 >> i) & 1);
        }
        printf("\n");
    }
}
